<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/12/30
 * Time: 15:16
 */
//http://baike.baidu.com/link?url=pLc5EcxvcEph6IDscI-MzgjU6ng89pmvLCtIIPedf3-spNeBkAj-9K6ZhaIqPj3bOHR2ndfmja3C2QeB6TglE_JUpKuFCFlHNrxOnJ1zUOa





//1.初始化一个curl对象
$curl=curl_init();
//2. 设置你需要抓取的URL的地址
curl_setopt($curl,CURLOPT_URL,'http://r.pengyou.com/fcg-bin/cgi_get_portrait.fcg?uins=1078337851');
//3.设置header
curl_setopt($curl,CURLOPT_HEADER,1);
//4.设置curl参数，将其保存到字符串中，还是输出到屏幕上,1是保存到字符串中，0是保存到屏幕上
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
//5.运行curl，请求网页
$data=curl_exec($curl);
//6.关闭curl的请求
curl_close($curl);
//显示获得的数据
//var_dump($data);
//print $data;
//print_r($data);



$result = [];
preg_match_all("/(?:\()(.*)(?:\))/i", $data, $result);
if (count($result[1]) <= 0) {
    return '';
}
else {

    $result = json_decode($result[1][0], true);
    return $result['240086834'][6];

}